let s="hello"
typeof s==="string"
typeof s==="number"
typeof s==="boolean"
typeof s==="undefined"
typeof s==="function"
typeof Array.isArray(s)


function wrapIArray(obj:string|string[]){
    if(typeof obj==="string"){
        return [obj];
    }
    return obj;
}


type StringArray=Array<string>
type NumberArray=Array<number>
type ObjectWithNameArray=Array<{name:string}>

interface Backpack<Type>{
    add:(obj:Type)=>void;
    get:()=>Type;
}

//这一行是告诉TypeScript存在的快捷方式
//常数叫做“背包”，不用担心它从哪里来。
declare const backpack=Backpack<string>;

const object=backpack.get();

backpack.add(23);


class VirtualPoint{
    x:number;
    y:number;

    constructor(x:number,y:number){
        this.x=x;
        this.y=y;
    }
}


const newVPoint=new VirtualPoint(13,56);
console.log(newVPoint);